<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="bean" value="${pedido}"/>
<c:set var="cliente" value="${cliente}"/>
<div id="area">
	<div class="content" id="work">
		<p>&nbsp;</p>
    <center>
      <table width="505" border="0">
        <tr>
              <td height="55" colspan="2"><h2>Alquiler <c:out value="${bean.codigoPedido}"/></h2></td>
              <td width="215"><h2><c:out value="${bean.estado}"/></h2></td>
        </tr>
            <tr>
              <td width="105" rowspan="5"><img src="<c:url value="/resources/images/consulta.jpg" />" width="100" height="80"></td>
              <td width="132">ID del Pedido</td>
              <td><c:out value="${bean.codigoPedido}"/></td>
            </tr>
            <tr>
              <td>Cliente</td>
              <td><c:out value="${cliente.empresa}"/>
              </td>
            </tr>
            <tr>
              <td>Fecha de inicio</td>
              <td><c:out value="${bean.fechaInicio}"/></td>
            </tr>
            <tr>
              <td>Fecha de entrega</td>
              <td><c:out value="${bean.fechaDevolucion}"/></td>
            </tr>
            <tr>
              <td>Nro. de Horas</td>
              <td><c:out value="${bean.dias}"/></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>% de Descuento</td>
              <td><c:out value="${bean.porcentaje}"/></td>
            </tr>
          </table>
      <table width="505" border="0">
        <tr>
          <td height="29" colspan="4">Maquinarias</td>
        </tr>
        <tr>
          <td>ID Maquinaria</td>
          <td>Descripcion</td>
          <td>Tarifa</td>
          <td>Subtotal</td>
        </tr>
        <c:set var="ssubtotal" value="0" /> 
        <c:forEach items="${detalle}" var="lista">     
        <tr>
          <td><c:out value="${lista.codigoMaquinaria}" /></td>
          <td><c:out value="${lista.descripcion}" /></td>
          <td><c:out value="${lista.precio}" /></td>
          <td><c:out value="${lista.subtotal}" /></td>
        </tr>
        <c:set var="ssubtotal" value="${ssubtotal + lista.subtotal}" />
        </c:forEach>
      </table>
      <table width="505" border="0">
        <tr>
          <td width="47">&nbsp;</td>
          <td width="269">&nbsp;</td>
          <td width="71">&nbsp;</td>
          <td width="100">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>Total</td>
          <td><c:out value="${ssubtotal}" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>Descuento</td>
          <c:set var="descuento" value="${bean.porcentaje*0.01*ssubtotal}" /> 
          <td><c:out value="${descuento}" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>Total Final</td>
          <c:set var="tfinal" value="${ssubtotal-descuento}" /> 
          <td><c:out value="${tfinal}" /></td>
        </tr>
      </table>
      <table width="505" border="0">
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><a href="pagar.gsp?code=${bean.codigoPedido}"><c:out value="Realizar Pago" /></a>
              <a href="anularPedido.htm?code=${bean.codigoPedido}"><c:out value="Anular Pedido" /></a>
          </td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </center>
      <p>&nbsp;</p>
	</div>
	<div class="sidenav" id="nave">
		<%@ include file="/WEB-INF/views/menu.jsp"%>
		<p>&nbsp;</p>
	</div>
</div>